@import '@/assets/css/mixins/mixins';

.o_table {
    table-layout: fixed;
    border-collapse: separate;
    font-size: 14px;
    color: #333;
    width: 100%;
    // background: #fff;
    .o_table--head {
        position: sticky;
        top: 0;
        z-index: 999;
    }
    .hide {
        display: none;
    }

    &--container {
        background: white;
        position: relative;
        border-right: 16px solid transparent;
        border-left: 16px solid transparent;
        height: 100%;
        width: 100%;
        flex: 1;
        overflow-y: scroll;
        &.single {
            background: none;

            .o_table--head {
                th {
                    &:first-child {
                        border-radius: 10px 0 0px 0px;
                    }

                    &:last-child {
                        border-radius: 0 10px 0px 0px;
                    }
                }

                &::after {
                    display: none;
                }
            }
        }
    }
    &--shrink {
        flex: 1;
    }
    &--center {
        display: flex;
        align-items: center;
        position: sticky;
        left: 0;
        &::after {
            content: '';
            bottom: -1px;
            overflow-x: hidden;
            overflow-y: hidden;
            pointer-events: none;
            position: absolute;
            top: 0;
            right: -10px;
            touch-action: none;
            width: 10px;
            box-shadow: inset 10px 0 10px -10px rgba(0, 0, 0, 0.15);
        }
        .el-checkbox {
            padding-right: 18px;
            padding-left: 18px;
        }
    }
    .close {
        background: #f5f5f5 !important;
    }

    .hover--class {
        $bc: #bebebe !important;

        &:hover {
            .body--header {
                border-color: $bc;
                position: relative;
            }

            .body--content {
                td {
                    border-color: $bc;

                    &:first-child {
                        border-color: $bc;
                    }

                    &:last-child {
                        border-color: $bc;
                    }
                }
            }
        }
    }

    .ordinary--class {
        $bc: #bcdfff;

        &:hover {
            .body--header {
                border-color: $bc;
            }

            .body--content {
                td {
                    border-color: $bc;

                    &:last-child {
                        border-color: $bc;
                    }
                }
            }
        }
    }

    .need--border {
        $bc: #bcdfff;

        .body--content {
            td {
                border-right: 1px solid $bc;

                &:last-child {
                    border-color: $bc;
                }
            }
        }
    }

    &--empty {
        .empty__td {
            width: 960px;
            height: 80px;
            background-color: white;
            margin-left: -15px;
            font-size: 14px;
            color: #b3b3b3;
        }
    }

    &--head {
        th {
            $b-c: #f7f8fa;
            background: #f7f8fa;
            padding: 10px 10px;
            text-align: left;
            color: #000;
            font-weight: 200;
            border-top: 1px solid $b-c;
            border-bottom: 1px solid $b-c;
            height: 50px;
            vertical-align: middle;
            font-size: 14px;
            font-weight: 550;
            // 表头文字不折行
            white-space: nowrap;
            &.align--center {
                text-align: center !important;
            }
            &.align--right {
                text-align: right !important;
            }
            &:first-child {
                border-left: 1px solid $b-c;
                padding-left: 0;
            }
            &:last-child {
                border-right: 1px solid $b-c;
                text-align: right;
            }
        }

        &:after {
            content: '-';
            display: block;
            line-height: 8px;
            color: transparent;
        }

        &.padding {
            &:after {
                content: '-';
                display: block;
                color: transparent;
            }
        }
    }

    $b-c: #f7f8fa;

    &--body {
        .body--header {
            @include flex(flex-start);
            font-size: 13px;
            height: 52px;
            vertical-align: middle;
            background: $b-c;
            position: relative;
            align-items: center;
            .remark_flag {
                position: sticky;
                right: 0;
                background: #f7f8fa;
                padding-left: 5px;
            }
            .header--checkbox {
                position: sticky;
                left: 0;
                height: 100%;
                // 继承
                background: $b-c;
                padding-right: 18px;
                padding-left: 18px;
            }
        }

        &.default {
            .body--content {
                .o_table--item {
                    &:first-child {
                        border-radius: 0px 0 0px 0px;
                    }

                    &:last-child {
                        border-radius: 0px 0px 0px 0px;
                    }
                }
            }

            .o_table--item {
                vertical-align: middle;
            }
        }

        .body--content {
            td {
                padding: 12px 13px;
                border-top: 0px;
                border-right: 0px;
                font-size: 12px;
                color: #50596d;
                background: #fff;
                vertical-align: middle;
                .item__content {
                    @include flex(flex-start);
                }

                .selection__checkbox {
                    display: inline-block;
                    width: 100%;
                    height: 100%;

                    &.selection {
                        @include flex(flex-start);
                    }
                }

                &:first-child {
                    padding-left: 18px;
                }
            }

            &.is--multiple {
                td {
                    &:first-child {
                        border-right: 1px solid $b-c !important;
                    }
                }
            }
        }
    }

    .fixed--right {
        position: sticky;
        right: 0;
        z-index: 1;
        &::before {
            position: absolute;
            content: '';
            left: -10px;
            bottom: -1px;
            content: '';
            overflow-x: hidden;
            overflow-y: hidden;
            pointer-events: none;
            top: 0;
            touch-action: none;
            width: 10px;
            box-shadow: none;
        }
    }
}
@include b(is-scrolling) {
    @include m(left) {
        .fixed--right::before {
            box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, 0.15);
        }
        .o_table--center::after {
            box-shadow: none !important;
        }
    }
    @include m(middle) {
        .fixed--right::before {
            box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, 0.15);
        }
        .o_table--center::after {
            box-shadow: inset 10px 0 10px -10px rgba(0, 0, 0, 0.15);
        }
    }
    @include m(right) {
        .fixed--right::before {
            box-shadow: none;
        }
        .o_table--center::after {
            box-shadow: inset 10px 0 10px -10px rgba(0, 0, 0, 0.15);
        }
    }
    @include m(none) {
        .fixed--right::before,
        .o_table--center::after {
            box-shadow: none;
        }
    }
}
